package com.hireceivecard.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/*******************************
 * @Author: lili
 * @Email: 974196651@qq.com
 * @CreateTime: 2024/3/24 10:39
 * @Describe: Swagger配置类
 *******************************/
@Configuration //配置类
@EnableSwagger2// 开启Swagger2的自动配置
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("HiReceiveCard")
                .description("test")
                .contact(new Contact("test", "", ""))
                .termsOfServiceUrl("http://localhost:8082/")
                .version("1.0")
                .build();
        return new Docket(DocumentationType.SWAGGER_2)
                .host("http://localhost:8082/")
                .groupName("后台接口")
                .apiInfo(apiInfo)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.hireceivecard"))
                .paths(PathSelectors.any())
                .build();
    }
}
